import requestFunction from "../request.js";
interface ApiResponse<T = any> {
	code: number;
	data: T;
	msg?: string;
	trace_id?: string;
}
// 获取通知消息列表
export const getMsg = (params?: Record<string, any>): Promise<ApiResponse> => {
	return requestFunction("messages", params, "GET");
};
// 获取消息列表（push/error/repair）
export const getEventApi = (
	params?: Record<string, any>
): Promise<ApiResponse> => {
	return requestFunction("events", params, "GET");
};

export const getEventExist = (params?: Record<string, any>) =>
	requestFunction<{ has_repair: boolean }>("events/exist", params, "GET");
//获取通知消息标题列表
export const getEventTitle = (
	params?: Record<string, any>
): Promise<ApiResponse> => {
	return requestFunction("events/titleList", params, "GET");
};
// 查询清洁记录详情
export const getRecordDetail = (
	params?: Record<string, any>
): Promise<ApiResponse> => {
	return requestFunction("record/by_plan_id", params, "GET");
};
// 获取消息数量
export const getMsgCount = (
	params?: Record<string, any>
): Promise<ApiResponse> => {
	return requestFunction("messages/count", params, "GET");
};
// 获取异常消息数量
export const getEventCount = (
	params?: Record<string, any>
): Promise<ApiResponse> => {
	return requestFunction("events/count", params, "GET");
};
// 查询清洁报告列表
export const getRecordPlans = (
	params?: Record<string, any>
): Promise<ApiResponse> => {
	return requestFunction("cleans/record", params, "GET");
};
// 查询清洁统计
export const getPeriodPlans = (
	params?: Record<string, any>
): Promise<ApiResponse> => {
	return requestFunction("cleans/period", params, "GET");
};
